package com.Abstract抽象类;

public class abstract练习 {
    public static void main(String[] args) {
        Manager e1 = new Manager("张三", 1, 10000, 5000);
        e1.work();

        CommonEmployee  m1 = new CommonEmployee("李四", 2, 20000);
        m1.work();
    }
}

abstract class Employee{
    private String name;
    private int id;
    private double salary;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public Employee(String name, int id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public abstract  void work();
}





class CommonEmployee extends Employee{
    public CommonEmployee(String name, int id, double salary) {
        super(name, id, salary);
    }

    public void work() {
        System.out.println("普通员工"+getName()+"正在工作");
    }
}



class Manager extends Employee{
    private double bonus;
    public Manager(String name, int id, double salary, double bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }

    public void work() {
        System.out.println("经理"+getName()+"正在管理");
    }
}

